package com.example.sunran.controller;

import com.example.sunran.domain.PhoneInfo;
import com.example.sunran.service.PhoneRecognizeService;
import com.example.sunran.service.impl.PhoneRecognizeServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @program: sunran
 * @description: 用于手机号码归属地页面的映射
 * @author: SunRan
 * @create: 2018-11-11 15:16
 **/

@Controller
public class PhoneController {

    private static PhoneRecognizeService phoneRecognizeService = new PhoneRecognizeServiceImpl();



    @ResponseBody
    @PostMapping("/recognizePhone")
    public PhoneInfo recognizePhone(@RequestBody Map<String,String> reqMap){
        String phone = reqMap.get("phone");
        PhoneInfo phoneInfo = phoneRecognizeService.onCall(phone);

        return phoneInfo ;
    }
}
